import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';

import {UserListComponent} from '../components/userList/userList';
import {UsersResolveService} from '../service/UsersResolveService';
import {DepartmentsAllResolveService} from '../service/DepartmentsAllResolveService';
import {AuthGuardService} from '../service/AuthGuardService';
import {SecurityComponent} from '../components/security/security';
import { UserInfoComponent } from '../components/userInfo/userInfo';

const routes: Routes = [
  {
    path: 'user',
    canActivate: [AuthGuardService],
    children: [
      {
        path: '',
        component: UserListComponent,
        resolve: {
          results: UsersResolveService,
          departments: DepartmentsAllResolveService
        },
      },
      {
        path: 'security',
        component: SecurityComponent
      },
      {
        path: 'userInfo',
        component: UserInfoComponent
      }
    ]
  },
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  providers: [
    UsersResolveService
  ]

})
export class UserRoutingModule {
}
